package cn.xk.basic.service.impl;


import cn.xk.basic.service.IBaiduAiAuditService;
import cn.xk.basic.util.BaiduAiUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

@Service
public class BaiduAiAuditServiceImpl implements IBaiduAiAuditService {

    @Override
    public Boolean textAudit(String auditText) {
        return BaiduAiUtils.TextCensor(auditText);
    }


    @Override
    public Boolean imageAudit(String resources) {
        if (!StringUtils.isEmpty(resources)) {//判断非空
            String[] urls = resources.split(",");//多个resources用,分开
            for (String url : urls) {
                if (!BaiduAiUtils.ImgCensor("http://123.207.27.208" + url)) {
                    return false;
                }
            }
        }
        return true;
    }
}